package com.sim.stream.service.impl;

import com.sim.stream.util.PropUtil;
import org.springframework.stereotype.Service;
import java.util.Random;

/**
 * 随机推送
 */
@Service
public class StreamRandPushServiceImpl extends StreamPushServiceImpl {
    @Override
    public String getUrl(String groupId,String UserId) {
        String[] hosts = PropUtil.getPushHosts();
        if(hosts != null && hosts.length > 0){
            Random random = new Random();
            this.setHost(hosts[random.nextInt(hosts.length)]);
        }
        return super.getUrl(groupId,UserId);
    }
}
